<!doctype html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <title>账户设置</title>
  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      font-family: "Microsoft YaHei", Arial, sans-serif;
    }

    .background-container {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: -1;
      background-size: cover;
      background-position: center;
      background-image: url('/static/images/1754888118516.jpg');
      filter: brightness(0.6);
    }

    .container {
      max-width: 500px;
      margin: 50px auto;
      padding: 30px;
      background: rgba(255, 255, 255, 0.85);
      border-radius: 10px;
      box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    }

    h2 {
      text-align: center;
      margin-bottom: 30px;
      color: #333;
    }

    .form-group {
      margin-bottom: 20px;
    }

    label {
      display: block;
      margin-bottom: 8px;
      font-weight: bold;
      color: #555;
    }

    input[type="text"],
    input[type="password"] {
      width: 100%;
      padding: 12px;
      border: 1px solid #ddd;
      border-radius: 5px;
      font-size: 16px;
      transition: border-color 0.3s;
    }

    input[type="text"]:focus,
    input[type="password"]:focus {
      border-color: #4a86e8;
      outline: none;
      box-shadow: 0 0 5px rgba(74, 134, 232, 0.3);
    }

    .btn-container {
      display: flex;
      justify-content: space-between;
      margin-top: 30px;
    }

    .btn {
      padding: 12px 24px;
      border: none;
      border-radius: 5px;
      font-size: 16px;
      cursor: pointer;
      transition: background-color 0.3s;
    }

    .submit-btn {
      background-color: #4a86e8;
      color: white;
    }

    .submit-btn:hover {
      background-color: #3a76d8;
    }

    .back-btn {
      background-color: #f0f0f0;
      color: #333;
    }

    .back-btn:hover {
      background-color: #e0e0e0;
    }

    .flash-messages {
      margin-bottom: 20px;
      color: #d9534f;
    }
  </style>
</head>
<body>
  <div class="background-container"></div>

  <div class="container">
    <h2>账户设置</h2>

    <!-- 提示消息 -->
    {% with messages = get_flashed_messages() %}
    {% if messages %}
    <div class="flash-messages">
      <ul>
        {% for message in messages %}
        <li>{{ message }}</li>
        {% endfor %}
      </ul>
    </div>
    {% endif %}
    {% endwith %}

    <form method="POST" action="{{ url_for('profile') }}">
      <div class="form-group">
        <label for="username">用户名</label>
        <input type="text" id="username" name="username" value="{{ username }}" required>
      </div>

      <div class="form-group">
        <label for="old_password">旧密码</label>
        <input type="password" id="old_password" name="old_password" required>
      </div>

      <div class="form-group">
        <label for="new_password">新密码 (留空则不修改)</label>
        <input type="password" id="new_password" name="new_password">
      </div>

      <div class="form-group">
        <label for="confirm_password">确认新密码</label>
        <input type="password" id="confirm_password" name="confirm_password">
      </div>

      <div class="btn-container">
        <a href="{{ url_for('dashboard') }}">
          <button type="button" class="btn back-btn">返回控制台</button>
        </a>
        <button type="submit" class="btn submit-btn">保存更改</button>
      </div>
    </form>
  </div>
</body>
</html>